import BuffUtil from '@/BuffUtil';

import ItemUtil from '@/ItemUtil';
import RandomUtil from '@/RandomUtil';
export default class Item_裂甲之刃 {
    static id = 'C00J';
    static 名称: string = '裂甲之刃';
    static 描述: string = '护甲被极大地降低了';
    static 图标: string = 'assets\\item\\INV_Knife_1H_ArtifactCthun_D_06.blp';
    static buffId: string = 'buff_item_liejiazhiren';
    static buffType: AppBuffType = {
        id: 'buff_item_liejiazhiren',
        name: Item_裂甲之刃.名称,
        ubertip: Item_裂甲之刃.描述,
        art: Item_裂甲之刃.图标,
        attribute: {
            附加护甲: -100,
        },
        isDebuff: true,
        dur: 5,
    };
    constructor() {
        BuffUtil.registerBuffType(Item_裂甲之刃.buffType);
        EventManager.onTakeAttack(Item_裂甲之刃.spellEffect);
    }
    static spellEffect(d: DamageEventData) {
        if (!ItemUtil.isUnitHasItem(d.source, Item_裂甲之刃.id)) return;
        let r = RandomUtil.randomPercent();
        if (r > 0.1) return;
        BuffUtil.addBuff(d.target, Item_裂甲之刃.buffId, d.source);
    }
}
